<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <jsp:include page="../common/header.jsp"/>
    <jsp:include page="../../common/layer.jsp"></jsp:include>

</head>
<body>
<form action="${pathUrl }/admin/goodsCatalog/index" method="post" id="userForm">
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">产品分类</a></li>
    </ul>
</div>

<div class="session-main">
    <table style="border: 0px;width:100%;">
      <tr>
       <td align="left" width="10%">
          <a onclick="alertFrame(0)" class="btn-add"><span><img src="${pathUrl }/public/images/t01.png"></span>添加</a>
       </td>
       <td align="right" width="90%">
	       <ul class="seachform" style="margin-top: 15px;float: right;">
	        <li><label>类型名称：</label><input name="name" value="${name}" type="text" class="scinput"></li>
	        <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"></li>
	    </ul>
       </td>
      </tr>
    </table>
    
    <div id="loadDiv">
    	<table class="tablelist">
            <tr><td>编号</td><td>名称</td><td>描述信息</td><td>操作</td></tr>
            <c:forEach items="${Pager.records}" var="temp">
                <tr>
                    <td>${temp.id}</td>
                    <td>${temp.name}</td>
                    <td>${temp.remark}</td>
                    <td>
                        <a onclick="alertFrame(${temp.id})">编辑</a>
                        <a onclick="deleteOne(${temp.id})">删除</a>
                    </td>
                </tr>
            </c:forEach>

        </table>
    </div>
    <div id="pagerDiv">
        <a href="${url}?pageNow=1&name=${name}">首页</a><a href="${url}?pageNow=${Pager.current==1?1:Pager.current-1}&name=${name}">上一页</a>&nbsp;&nbsp; ${Pager.current}/${pages} &nbsp;&nbsp;<a href="${url}?pageNow=${Pager.current==pages?pages:Pager.current+1}&name=${name}">下一页</a> <a href="${url}?pageNow=${pages}&name=${name}">尾页</a>
    </div>

   
</div>
</form>
<jsp:include page="../../common/laypage.jsp"/>

<script type="text/javascript">
    function deleteOne(id){
        ydlConfrim("你是否删除选择的数据？",function(){
            var url="${pathUrl}/admin/goodsCatalog/delete";
            $.post(url,{id:id},function(result){
                layer.alert('id为'+id+'的数据删除成功', {icon: 1}, function () {
                    window.location.href="${pathUrl}/admin/goodsCatalog/index";
                });

            });

        });

    }

    function alertFrame(id) {
        layer.open({
            type: 2,
            title: '',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '${pathUrl}/admin/goodsCatalog/toAdd?id='+id
        });
    }
</script>

</body>
</html>